package com.esoon.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

import com.esoon.smartsee.MainActivity;
import com.esoon.smartsee.R;
import com.esoon.smartsee.VideoActivity;
import com.mb.voip.api.MBVoipClientApp;
import com.mb.voip.api.VTCall;
import com.mb.voip.api.VTCallStateListener;
import com.mb.voip.api.VideoPhone;
import com.mb.voip.api.VideoPhoneDataBean;
import com.mb.voip.api.mbVTCallsManager;

import butterknife.ButterKnife;
import butterknife.OnClick;


public class CallingServiceActivity extends AppCompatActivity implements VTCallStateListener {
    @OnClick(R.id.hungup)
    public void hungup() {

        MBVoipClientApp client = MBVoipClientApp.getVoipClientApp();
        mbVTCallsManager callsManager = mbVTCallsManager.getManager();
        int callid = callsManager.getActiveCallId();
        client.DropCall(callid);
        this.finish();

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_calling_service);

        ButterKnife.bind(this);
    }

    @Override
    public void onVTCallStateChanged(VideoPhone videoPhone, int i, int state, int i2, int i3, Object o) {
        switch (state) {

            case VideoPhoneDataBean.MBVoipCall_Registration:

                break;


            case VideoPhoneDataBean.MBVoipCall_Initialization:
                break;

            case VideoPhoneDataBean.MBVoipCall_Unregistration:
                break;

            case VideoPhoneDataBean.MBVoipCall_RegistrationFailed:


            case VideoPhoneDataBean.MBVoipCall_Inviting:


                break;

            case VideoPhoneDataBean.MBVoipCall_Offering:


                break;

            case VideoPhoneDataBean.MBVoipCall_Connected:

                CallingServiceActivity.this.finish();
                break;
            case VideoPhoneDataBean.MBVoipCall_Disonnected:
                CallingServiceActivity.this.finish();
                break;


        }
    }
}
